// 基础路径 注意发布之前要先修改这里
let publicPath = process.env.VUE_APP_PUBLIC_PATH || '/'
if ("development" === process.env.NODE_ENV) {
    publicPath = "/"
} else if ("production" === process.env.NODE_ENV) {
    publicPath = './'
}


const path = require('path');

function resolve(dir) {
    return path.join(__dirname, dir)
}

module.exports = {
    publicPath: publicPath,
    lintOnSave: true,
    devServer: {
        publicPath
    },
    configureWebpack: config => {
        const configNew = {}
        if (process.env.NODE_ENV === 'production') {
            configNew.externals = {}
        }
        if (process.env.NODE_ENV === 'development') {
            configNew.devServer = {
                disableHostCheck: true,
                proxy: {
                    '/xwjxApi/upload/form': {
                        target: 'http://192.168.1.33:8888',
                        ws: true,
                        pathRewrite: {
                            '^/xwjxApi': '/xwjxApi'
                        }
                    },
                    '/xwjxApi/ueditor/': {
                        target: 'http://192.168.1.33:8888',
                        ws: true,
                        pathRewrite: {
                            '^/xwjxApi': '/xwjxApi'
                        }
                    },
                    '/xwjxApi/ueditor/jsp/': {
                        target: 'http://192.168.1.33:8888',
                        ws: true,
                        pathRewrite: {
                            '^/xwjxApi': '/xwjxApi'
                        }
                    },
                    '/xwjxApi': {
                        target: 'http://192.168.1.33:8888',
                        ws: true,
                        pathRewrite: {
                            '^/xwjxApi': '/xwjxApi'
                        }
                    }
                }
            }
        }
        return configNew
    },
}
